import java.util.Scanner;

public class shiyan1_2 {
    public static void main(String[] args){
        String userInput1;
        String userInput2;
        Scanner scan = new Scanner(System.in);
        System.out.println("1:字符串相加,2:整数加,3浮点数加,4退出");
        while(true) {
            int Uswich = Integer.parseInt(scan.nextLine());
            System.out.println("请输入两个字符串");
            userInput1 = scan.nextLine();
            userInput2 = scan.nextLine();
            if (Uswich == 1) {
                System.out.println(funStringAdd(userInput1, userInput2));
            } else if (Uswich == 2) {
                System.out.println(funIntAdd(userInput1, userInput2));
            } else if (Uswich == 3) {
                System.out.println(funFloatAdd(userInput1, userInput2));
            } else if (Uswich == 4){
                break;
            }
            else {
                System.out.println("输入错误!");
            }
        }
        scan.close();
    }

    //字符串拼接
    public static String funStringAdd(String str1,String str2){
       return str1+str2;
    }

    public static int funIntAdd(String str1,String str2){
        int a=0;
        int b=0;
        try{
            a = Integer.parseInt(str1);
            b = Integer.parseInt(str2);
        }
        catch (Exception e){
            System.out.println("无法将用户的输入转换为int类型");
        }
        return a+b;
    }

    public static float funFloatAdd(String str1,String str2){
        float a=0;
        float b=0;
        try{
            a = Float.parseFloat(str1);
            b = Float.parseFloat(str2);
        }
        catch (Exception e){
            System.out.println("无法将用户的输入转换为float类型");
        }
        return a+b;
    }
}
